﻿@model XSTDZ.ERP.Application.DataContracts.ProfitAndLossBillDto

@{
    ViewBag.Title = " - 编辑损溢报告";
}
@section header{
     <link href="@Url.Content("~/Content/Controls.css")" rel="stylesheet" type="text/css" />
 <link href="@Url.Content("~/Content/Form.css")" rel="stylesheet" type="text/css" />
}
<div class="wp100">


@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <table class="formtable">
    <thead>
        <tr>
            <th colspan="4">@* <h2>新增入库单</h2>*@
            <div id="toptoolbar"></div>
            </th>
        </tr>
    </thead>
    
     <tr>
       
        <td class="title"> @Html.LabelFor(model => model.ProfitAndLossNo)</td>
        <td> @Html.TextBoxFor(model => model.ProfitAndLossNo, new { @class = "text disablebg", @readonly = "readonly" })
        @Html.ValidationMessageFor(model => model.ProfitAndLossNo)
         <input type="hidden" value="@ViewBag.TempId" id="hidbillDetailId" name="hidbillDetailId" />
          @Html.HiddenFor(model => model.CheckState)
           @Html.HiddenFor(model => model.BillState)
          @Html.HiddenFor(model => model.Id)
        </td>

        <td class="title">@Html.LabelFor(model => model.StorehouseID)</td>
        <td>  @Html.TextBoxFor(model => model.StorehouseName, new { @class = "text disablebg", @readonly = "readonly" })
          @Html.HiddenFor(model => model.StorehouseID)
            @Html.ValidationMessageFor(model => model.StorehouseID)
         </td>
  </tr>
         <tr>
       
        <td class="title"> @Html.LabelFor(model => model.Remarks)</td>
        <td> @Html.TextBoxFor(model => model.Remarks, new { @class = "text disablebg", @readonly = "readonly" })
        @Html.ValidationMessageFor(model => model.Remarks)
        </td>

        <td class="title"></td>
        <td>  
         </td>
  </tr> 
  <tr>
        <td  colspan="4">
              <p class="divBtn">
                <input type="hidden" value="" name="hidProductBillItems" id="hidProductBillItems" />
               <input type="hidden" id="hidHttpRefeParent" name="hidHttpRefeParent" value="grid" />
       @*     <input type="button" value="@XSTDZ.ERP.Infrastructure.SystemConfig.BtnSave"  class="BtnSubmit" id="submitBtn" name="submitBtn" />
            <input type="button" value="@XSTDZ.ERP.Infrastructure.SystemConfig.BtnSubmit"  class="BtnSubmit" id="btnSubmit" name="btnSubmit" />*@
            <input type="button" value="@XSTDZ.ERP.Infrastructure.SystemConfig.BtnAudit"  class="BtnSubmit" id="btnAudit" name="btnAudit" />
           @* <input type="button" value="@XSTDZ.ERP.Infrastructure.SystemConfig.BtnAuditNO"  class="BtnSubmit" id="btnAuditNo" name="btnAuditNo" />*@
           @* <input type="button" value="@XSTDZ.ERP.Infrastructure.SystemConfig.BtnClose" id="btnFromClose" name="btnFromClose" class="BtnClose" />*@
        </p>
        </td>
    </tr>
    </table>
        <input id="HidOrgCode" name="HidOrgCode" type="hidden" value="@ViewBag.orgCode" />
        <input id="HidEmptyGuid" name="HidEmptyGuid" type="hidden" value="@Guid.Empty" />
}
</div>
<div class="wp100">
<div id="ProfitAndLossItemsGrid" style="margin-top:20px" ></div>
</div>


<script type="text/javascript">
    $(document).ready(function () {
      
//        $("#StorehouseName").ligerPopupEdit({
//            grid: getGridOptions(false),
//            valueField: 'Id',
//            textField: 'StorehouseName'
//        });
       

      //  $("#submitBtn").unbind("click").bind("click", getProductBillItemData);
    });

    function getProductBillItemData() {

        var isCheckState = $("#CheckState").val();
        if (isCheckState == "1") {
            $.ligerDialog.success('已审核，不能修改!');
        } else {

            if (manager != null && manager != undefined) {
                var data = manager.getData();
                $("#hidProductBillItems").val("").val(JSON.stringify(data));
                var btnText = $("#submitBtn").val();
                $("#submitBtn").val("").val("正在处理中...");
                $.ajax({ type: "POST", url: "/ProfitAndLoss/Add", data: $("form").serialize(), // 要提交的表单
                    success: function (msg) {
                        if (msg == "9") {
                            $.ligerDialog.success('操作成功!');
                            //                        initligerGrid();
                            ajaxSubmitSuccess(); //公共类：提交成功后关闭当前窗口
                        }
                        else if (msg == "-1") {
                            $.ligerDialog.success('损溢报告明细数据不完整,操作失败!');
                        }
                        else {
                            $.ligerDialog.success('操作失败!');
                        }
                        $("#submitBtn").val("").val(btnText);
                    }
                });
            }
        }
    } 

</script>
<input id="HidOrgCode" name="HidOrgCode" type="hidden" value="@ViewBag.orgCode" />

<script type="text/javascript" src="@Url.Content("~/Scripts/ligerUI/js/plugins/ligerPopupEdit.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/ligerUI/js/plugins/ligerDateEditor.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/js/ProfitAndLoss/Add.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/js/SelectData.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Content/js/formBase.js")"></script>